﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.Serialization;

namespace Tab2Sql.XmlTemplates
{
    /// <summary>
    ///
    /// </summary>
    public class LoadTemplates
    {
        template temp1;
        /// <summary>
        ///
        /// </summary>
        /// <param name="filename">
        /// A <see cref="System.String"/>
        /// </param>
        /// <returns>
        /// A <see cref="template"/>
        /// </returns>
        public static template DeserializeFromXML(string filename)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(template));
            TextReader textReader = new StreamReader(filename);
            template Template;
            Template = (template)deserializer.Deserialize(textReader);
            textReader.Close();
            return Template;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName">
        /// A <see cref="System.String"/>
        /// </param>
        public LoadTemplates(string fileName)
        {

            temp1 = DeserializeFromXML(fileName);
            column[] col = temp1.columns;
            
            foreach (column c in temp1.columns)
            {

            }

        }
/// <summary>
/// 
/// </summary>
/// <returns>
/// A <see cref="System.String[]"/>
/// </returns>
        public string[] SplitByFixed()
        {
            return new string[] {"foo"};
        }
    }
}
